<template>



  <div class="dashboard-container">
    <div v-if="!noPanel" class="dashboard-pic" style="height:400px;">您好!欢迎光临有吖管理系统！</div>





  </div>
</template>

<script>
import { mapGetters } from 'vuex'
//公共js
	import global_ from "@/utils/GlobalDict";//字典
	import {formatDate,daysBefore,formatMoney } from "@/utils/FormatUtil";//引入格式化工具
	import { cascaderIdSelector,getcascaderId } from "@/utils/datahelper";//数据辅助

import { getObjArr } from "@/permission";
import ElRow from "element-ui/packages/row/src/row";
//获取基本信息


export default {
    components: {ElRow},
    name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name',
      'roles'
    ])
  },
  filters: {
      indexFilter(val){
          var rtn = '';
          switch(val){
              case 0:
                rtn = '冠军';
                break;
              case 1:
                  rtn = '亚军';
                  break;
              case 2:
                  rtn = '季军';
                  break;
              case 3:
                  rtn = 'NO.4';
                  break;
              case 4:
                  rtn = 'NO.5';
                  break;
              default:
                  break;
          }
          return rtn;
      },
      attendanceFilter(val){
          if(val==1){
              return '正常'
          }else if(val==0.5){
              return '请假半天'
          }else{
              return '请假一天'
          }
      },
      reportStatusFilter(val){
          if(!val){
              val = 1;
          }
          if(val==1){
              return '未汇报'
          }else {
              return '已汇报'
          }
      }
  },
	data(){
		return{
            noPanel:false,
            listLoading:false,
            eSaleList:[],
            regionRankList:[],
            teamRankList:[],
            userRankList:[],
            orderList:[],
            releaseList:[],
            visitList:[],
            userOutList:[],
            cwbList:[],
            adviserFlag:false,
            chargerFlag:false,
            managerFlag:false,
            saleFlag:false,
            bussFlag:false,
            userTaskList:[],
            taskNumMap:{},
		}
	},
	methods: {
		getPanel(){
			panel().then(response => {
			    var rtnData = response.data;
			    this.noPanel = rtnData.noPanel;
			    if(this.noPanel){
                    this.eSaleList = rtnData.eSaleList;
                    this.regionRankList = rtnData.regionRankList;
                    this.teamRankList = rtnData.teamRankList;
                    this.userRankList = rtnData.userRankList;
                    this.orderList = rtnData.orderList;
                    this.releaseList = rtnData.releaseList;
                    this.visitList = rtnData.visitList;
                    this.userOutList = rtnData.userOutList;
                    this.cwbList = rtnData.cwbList;

                    this.userTaskList = rtnData.userTaskList;
                    this.taskNumMap = rtnData.taskNumMap;
                    var panelType = rtnData.panelType;
                    if(panelType=='sale_adviser'){
                        this.adviserFlag = true;
                        this.saleFlag = true;
                    }else if(panelType=='sale_charger'){
                        this.chargerFlag = true;
                        this.saleFlag = true;
                    }else if(panelType=='sale_manager'){
                        this.managerFlag = true;
                        this.saleFlag = true;
                    }else{
                        this.bussFlag = true;
                    }
                }

			});
		},
        cellClassFun(obj){
		    var rowIndex = obj.rowIndex;
		    var columnIndex = obj.columnIndex;
		    if(columnIndex==0){
		        if(rowIndex==0){
		            return 'background: #ff6600; color: #ffffff;';
                }else if(rowIndex==1){
		            return 'background: #ff9999; color: #ffffff;';
                }else if(rowIndex==2){
                    return 'background: #3366cc; color: #ffffff;';
                }
            }
            return '';
        },
        moreView(type){
            if(type==1){//合同
                if(this.adviserFlag){
                    this.$router.push({
                        name: `customerOrder`,
                        params:{},
                    })
                }else if(this.chargerFlag || this.managerFlag){
                    this.$router.push({
                        name: `teamOrder`,
                        params:{},
                    })
                }
            }else if(type==2){//客户释放统计
                if(this.adviserFlag){
                    this.$router.push({
                        name: `customerList`,
                        params:{},
                    })
                }else if(this.chargerFlag || this.managerFlag){
                    this.$router.push({
                        name: `teamCustomer`,
                        params:{},
                    })
                }
            }else if(type==3){//预约拜访
                if(this.adviserFlag){
                    this.$router.push({
                        name: `customerVisit`,
                        params:{},
                    })
                }else if(this.chargerFlag || this.managerFlag){
                    this.$router.push({
                        name: `customerVisitTeam`,
                        params:{},
                    })
                }
            }else if(type==4){//外出拜访
                if(this.adviserFlag){
                    this.$router.push({
                        name: `userOut`,
                        params:{},
                    })
                }else if(this.chargerFlag || this.managerFlag){
                    this.$router.push({
                        name: `userOutAdmin`,
                        params:{},
                    })
                }
            }else if(type==5){//工作汇报
                if(this.adviserFlag){
                    this.$router.push({
                        name: `portalWork`,
                        params:{},
                    })
                }else if(this.chargerFlag ){
                    this.$router.push({
                        name: `userWord`,
                        params:{},
                    })
                }else if(this.managerFlag ){
                    this.$router.push({
                        name: `teamWord`,
                        params:{},
                    })
                }
            }

        }
	},
	created() {
		this.getPanel();
	}
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
  &-pic{
    font-size: 50px;
    line-height: 80px;
    width: 100%;
    height: 400px;
    display: block;
    margin: 10% auto 0 auto;
    color: #15a589;
    font-weight: bold;
    text-align: center;
    max-width: 900px;
    background: url(../../assets/Welcome.jpg) no-repeat center bottom;
    block-size: 100%;
  }
}
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}


.index_tol{display: block; width: 98%; border: 1px solid #F1F1F1; margin: 15px auto; overflow: hidden;}
.index_tol span{width: 33.3%; float: left; height: 80px; text-align: center; margin-left: -1px; border-left:1px solid #F1F1F1 ; font-size: 14px;}
.index_tol span strong{display: block; font-size: 18px; line-height: 2.5em; color: #0066cc;}

</style>
